/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package EntityClass;

import java.io.Serializable;
import java.util.Collection;
import java.util.ArrayList;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.OneToOne;
import javax.persistence.OneToMany;


/**
 *
 * @author Ben
 */
@Entity
public class MPI implements Serializable {
   

    @Id
    private Long MPIid;
    @OneToOne(mappedBy="mpi")
    private Patient patient;
    
    @OneToMany(cascade={CascadeType.ALL}, mappedBy="mpi")
    private Collection<PIN> pins = new ArrayList<PIN>();
    
    public MPI(){}
    public void create(Long MPIid){
        this.setId(MPIid);
    }
    
    @OneToMany(cascade={CascadeType.PERSIST})
    public Collection<PIN> getPINS(){
        return pins;
    }
    
    public void setPINS(Collection<PIN> pins){
        this.pins=pins;
    }
    
        public Patient getPatient(){
        return patient;
    }
    
    public void setPatient(Patient patient){
        this.patient=patient;
    }
    
    @Id
    public Long getId() {
        return MPIid;
    }

    public void setId(Long MPIid) {
        this.MPIid = MPIid;
    }

    
    
}
